[#ftl]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>行业管理</title> 
<css>
    <style type="text/css">
        ul.ztree {
            margin-top: 10px;
            border: 1px solid #617775;
            width:220px;
            height:400px;
            overflow-y:scroll;
            overflow-x:auto;
        }
    </style>
</css>
<script type="text/javascript">
var indexmenu=2;
var indexmenu2=1;
/*弹出提醒框*/
function tips(param){
       var d=dialog({
                content: param,
                icon: 'succeed',
                fixed: true,
                lock: true,
            });
            d.show();
            setTimeout(function () {
                d.close().remove();
            }, 2000);
            return false;
} 
$(function(){
    var setting = {
            view: {
                selectedMulti: false
            },
            async: {
                enable: true,
                url:"${base}/uyo/platIndustry/childDatas",
                autoParam:["id"],
                dataFilter: filter
            },
/*            check: {
                isSimpleData: true,
                enable: true,
                chkStyle: "radio",
                radioType : "all",
                chkboxType : { "Y" : "", "N" : "" }
            },
   */
            callback: {
                onAsyncSuccess: zTreeOnAsyncSuccess,
                onClick: zTreeOnClick
            }
        };
        
    function zTreeOnClick(event, treeId, treeNode) {
         $("#selectedId").val(treeNode.id);      
         $("#selectedName").val(treeNode.name);      
         $.ajax({
              url: "${base}/uyo/platIndustry/"+treeNode.id+"/update", 
              type:"GET",
              dataType:"html",
              cache: false,
              success: function(val){
                 $("#detail").html(val);                     
              },
              error:function(XMLHttpRequest, textStatus, errorThrown){
                 //alert(XMLHttpRequest.readyState + XMLHttpRequest.status + XMLHttpRequest.responseText);
              }
        });
    };
    function zTreeOnAsyncSuccess(event, treeId, treeNode, msg) {
         var currentNodeId=$("#selectedId").val();
         if(currentNodeId!=null && currentNodeId!=0){    
            var treeObj = $.fn.zTree.getZTreeObj(treeId);
            var node = treeObj.getNodeByParam("id", currentNodeId, null);
            treeObj.selectNode(node);
            node.checked=true;
         }
    };
    function filter(treeId, parentNode, childNodes) {
        if (!childNodes) return null;
        for (var i=0, l=childNodes.length; i<l; i++) {
            childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
        }
        return childNodes;
    } 
    $.fn.zTree.init($("#treedatas"), setting); 
});  

//确认删除start
function deleteA(param){
  if (confirm("确定要删除这一项数据吗？")) {
      var thisNode=$(param).parent().parent();
      var id=thisNode.find("input:eq(0)").attr("value");
      $.ajax({
           type : "post",
           url : "${base}/uyo/platIndustry/"+id+"/delete",
           traditional:true,
           dataType: "json",
           success: function(data){ 
            var messages = extendMessages(data);
                    noty({
                             text:extendMessages(data).msg.message,
                              layout:"center",
                              timeout:2000,
                              callback:{
                                afterShow:function(){                                  
                                    if(messages.isAllSuccess())
                                    {
                                        thisNode.remove();
                                    }
                                }
                              }                          
                   });
            },
            error:function(){
            }
     }); 
   }        
}
//确认删除end

 function addA(){
      var parentId=$("#selectedId").val(); 
      var parentName=$("#selectedName").val();   
/*     d=dialog({
            url:'${base}/uyo/platIndustry/add?parentId='+parentId, 
            title: '添加类别',
            background: '#EEE', // 背景色
            opacity: 0.05,  // 透明度
            width: 600,
            height: 450
          });       
        d.showModal();  
*/     
         $.ajax({
              url: '${base}/uyo/platIndustry/add?parentId='+parentId, 
              type:"GET",
              dataType:"html",
              cache: false,
              success: function(val){
                 $("#detail").html(val);                     
              },
              error:function(XMLHttpRequest, textStatus, errorThrown){
                 //alert(XMLHttpRequest.readyState + XMLHttpRequest.status + XMLHttpRequest.responseText);
              }
        });      
 } 

</script>
</head>
<body> 
  <form id="queryform" method='POST'>
    <!-- 右侧标题结束 -->
    <!-- 右侧主要内容开始 -->
     <div class="right_top"><span class='pl20 f14'>行业管理</span></div>
     <div class="ml10 mt10"><input type="button" class="btn_1" onclick="addA();" value="添加"></div>
     <input type='hidden' name="selectedId" id="selectedId" value='0'>
     <input type='hidden' name="selectedName" id="selectedName" value=''>
      
     <div class="mt10 ml10"  style="height:450px">
         <div  style="width:250px" class="fl">
             <ul id="treedatas" class="ztree"></ul>
         </div>
         <div id="detail" class="list_right pt8 mr100" style="width:690px"></div>
       </div>    
  </form> 
  
</body>
</html>